fix(socket sink): reconnect and retry on datagram socket send failure#24834
Draft
thomasqueirozb wants to merge 3 commits intomasterfrom
Draft
fix(socket sink): reconnect and retry on datagram socket send failure#24834thomasqueirozb wants to merge 3 commits intomasterfrom
thomasqueirozb wants to merge 3 commits intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a UDP or Unix datagram socket
send()fails (e.g. "Destination address required" / OS error 89 due to DNS resolution changes),send_datagrams()would continue consuming events from the input stream and attempting to send them on the same broken socket, silently dropping all remaining events. The outerrun()loop already handles reconnection butsend_datagrams()never returned early to let that happen.This adopts the same pre-encode + peek/consume pattern used by TCP and Unix stream sinks: events are encoded before the peekable stream boundary so
send_datagrams()can peek without consuming. On socket errors the event stays in the stream and is retried after reconnection with a fresh socket (and fresh DNS resolution). Chunking errors still consume and error the event since reconnecting wouldn't help.Vector configuration
How did you test this PR?
cargo clippy --no-default-features --features "sinks-socket" -- -D warningscargo nextest run --workspace --no-default-features --features "sinks-socket" sinks::socket(7 passed)cargo nextest run --workspace --no-default-features --features "sinks-socket" sinks::util::unix(2 passed)Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
NA